<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript" src="<s:url value='/ui/swfobject.js' />"></script>
<link rel="stylesheet" type="text/css" href="<s:url value='/ui/workflow/css/wfmc.css'/>" />
<script type="text/javascript" src="<s:url value='/ui/workflow/raphael.js'/>"></script>
<style type="text/css">
.erectTab_border{border:1px solid #95C9E1;width:770px;margin:0px;padding:0px;margin-bottom:15px; overflow:hidden;}
.erectTab_menuBox {line-height:28px;position:relative; float:left; width:130px; height:400px;border-right:1px solid #95C9E1;}
.erectTab_menuBox ul{margin:0px;padding:0px;list-style:none; position:absolute; top:15px; left:5px; margin-left:10px; height:25px;text-align:center;}
.erectTab_menuBox li{display:block;cursor:pointer;width:114px;color:#949694;font-weight:bold; margin-bottom:5px;height:25px;line-height:25px; background-color:#E4F2FD}
.erectTab_menuBox li.hover{padding:0px;background:#fff;width:116px;border:1px solid #95C9E1; border-right:0;color:#739242;height:25px;line-height:25px;}
.erectTab_contentBox{margin-top:0px; border-top:none;border-left:0; margin-left:130px;height:400px; overflow:hidden;}
</style>
<!--
<script type="text/javascript" src="<s:url value='/common-scripts/js/wfmc.designer.min.js'/>"></script>
-->
 <script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.modal.ProcessDefinition.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.modal.Activity.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.modal.Transition.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.util.Array.js'/>"></script>

<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.control.Context.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.view.shape.Bakground.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.view.shape.HotPoint.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.view.shape.PathHotPoint.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.view.shape.StartNode.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.view.shape.dragevent.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.designer.view.command.createCommand.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.util.compareCoordinate.js'/>"></script>
<script type="text/javascript" src="<s:url value='/ui/workflow/wfmc.util.contextMenu.js'/>"></script>
<script lang="javascript" type="text/javascript">
var context = null;
var rightClickObj = null;
$(function(){
	context = new Context({
			id: "canvas_container",
			readOnly: false
	});	
	/**右键事件*/
	context.menuClick = function(objName, action, obj){
		console.log(objName);
		console.log(action);
		console.log(obj);
	}
	context.objClick = function(event, objType, obj) {
	    
	};
	context.objMouseover = function(event, objType, obj) {
		
	};
	context.objMouseout = function(event, objType, obj) {
		
	};
	
	$('#btn_definition_draw_save').bind('click',function(){
		console.log(context);
	});
	
});


//删除流程属性
function removeProcessProperty(sel) {
    var idx = sel.selectedIndex;
    if (idx >= 0) {
    	sel.remove(idx);
    }
    if (idx < sel.options.length) {
    	sel.selectedIndex = idx;
    } else if (sel.options.length > 0) {
    	sel.selectedIndex = sel.options.length - 1;
    }
};


function eventAction(obj, eventType, objId) {
    var actionList = [], eventObj = new Object(), eventSid = context.getUuid();
    if (obj[eventType] && obj[eventType].length > 0) {
        $.each(obj[eventType], function() {
            this["sid"] = context.getUuid();
            this["eventSid"] = eventSid;
            this["isTransient"] = true;
            var scripts = this.scripts;
            if(scripts!= undefined && scripts != ""){
            	scripts = scripts.replace("&amp;","&");
            	scripts = scripts.replace("&lt","<");
            	this.scripts = scripts.replace("&gt",">");
            }
            actionList.push(this);
        });
        eventObj["eventType"] = eventType;
        eventObj[objId] = obj.sid;
        eventObj["sid"] = eventSid;
        eventObj["isTransient"] = true;
        return {
            event: eventObj,
            actionList: actionList
        };
    } else {
        return null;
    }
};
</script>
<div id="easyui-title" style="display:none">
		            	流程绘制
</div>


<div id="layout" class="easyui-layout" fit="true" split="false" style="width: 100%;height: 100%;">
		<!-- 查询条件栏 -->
		<div class="easyui-panel" style="width:60px;height: 100%;" region="west" border="false">
			<div id="definition-toolbar" >
				<a id="btn_definition_draw_save" class="easyui-linkbutton" >保存</a>
				<a id="btn_definition_draw_return" class="easyui-linkbutton" >返回</a>
				<a  class="easyui-linkbutton" onclick="context.create('')">选择</a>
				<a  class="easyui-linkbutton" onclick="context.create('R')">开始</a>
				<a  class="easyui-linkbutton" onclick="context.create('E')">结束</a>
				<a  class="easyui-linkbutton" onclick="context.create('U')">节点</a>
				<!-- 
				<a  class="easyui-linkbutton" onclick="context.create('F')">分支</a>
				<a  class="easyui-linkbutton" onclick="context.create('J')">汇聚</a>
				 -->
				<a  class="easyui-linkbutton" onclick="context.create('D')">判断</a>
				<a  class="easyui-linkbutton" onclick="context.create('line')">路由</a>
			</div>
		</div>
		<div region="center" border="false" style="overflow: hidden;border: 1px solid #000000;">
			<div class="wfmc_body" style="overflow: auto; width: 100%; height: 100%;position:absolute;">
				<div id="canvas_container" style="overflow: none;width:4000px;height:2000px;"></div>
			</div>
		</div>
	</div>
	<ul id="processMenu" class="contextMenu">
		<li class="edit"><a href="#variable">流程属性</a></li>
	</ul>
	<ul id="activityMenu" class="contextMenu">
		<li class="edit"><a href="#edit">编辑节点</a></li>
		<li class="delete"><a href="#delete">删除节点</a></li>
		<li class="copy"><a href="#copy">复制节点</a></li>
	</ul>
	<ul id="transitionMenu" class="contextMenu">
		<li class="edit"><a href="#edit">编辑路由</a></li>
		<li class="delete"><a href="#delete">删除路由</a></li>
	</ul>
</div>


